package com.cmwa.solution.business.investTrade.controller;

import javax.annotation.Resource;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cmwa.solution.base.controller.BaseController;
import com.cmwa.solution.base.entity.Page;
import com.cmwa.solution.base.entity.SearchParam;
import com.cmwa.solution.business.investTrade.entity.TradeTrialResultVo;
import com.cmwa.solution.business.investTrade.service.TradeTrialResultService;
import com.cmwa.solution.utils.SessionUtils;

/**
 * 交易风控试算结果
 * @author ex-chenbq
 *
 */
@Controller
@RequestMapping("/business/tradeTrialResult")
public class TradeTrialResultController extends BaseController {

	private final static String JSP_PATH = "business/investTrade/";
	@Resource
	private TradeTrialResultService tradeTrialResultService;
		
	/**
	 * 跳转交易风控试算结果页面
	 * @param model
	 * @return
	 */
	@RequestMapping("/tradeTrialResultListView")
	public String tradeCashListView(ModelMap model) {
		return JSP_PATH + "tradeTrialResultList";
	}
	
	/**
	 * 交易风控试算结果数据分页查询
	 * @param param
	 * @return
	 */
	@RequestMapping("/tradeTrialResultList")
	@ResponseBody
	public Page<TradeTrialResultVo> tradeCashList(SearchParam param) {
		if (StringUtils.equals(SessionUtils.getEmployee().getEmpType(), "OUT")) {
			param.getSp().put("empId", SessionUtils.getEmployee().getID());
		}
		Page<TradeTrialResultVo> list = tradeTrialResultService.queryTradeTrialResultListPage(param);
		return list;
	}
}

